﻿<%@ Page Title="" Language="C#" MasterPageFile="ReconSite.Master" AutoEventWireup="true"
    CodeBehind="RemitterMatchInvoice.aspx.cs" Inherits="Recon.Portal.WebUI.RemitterMatchInvoice" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="TitleContent" ContentPlaceHolderID="TitleHolder" runat="server">
    <title>Remitter :: Match Invoices</title>
    <style type="text/css">
        .auto-style3
        {
            height: 27px;
        }
        .auto-style4
        {
            height: 53px;
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyHolder" runat="server">
     <div class="formDiv" id="formMatchDiv">
     <h2 class="formTitle">Remitter Match Invoice</h2>
    <%--<span title="Invoice List" style="azimuth: left; position: absolute; top: 200px;
        left: 100px; width: 400px;">--%>
         <table>
             <tr>
                 <td>
                      <asp:Button ID="btnConfirmMatches" runat="server" Text="Confirm Matches" OnClick="btnConfirmMatches_Click" Visible="true" />
                 </td>
                 <td>
                     <span>
                         <asp:TextBox ID="txtSearchStatement" runat="server" />
                         <asp:Button ID="btnSearchStatement" Text="Search Statement" runat="server" OnClick="btnSearchStatement_Click" />
                          
                     </span>
                 </td>
                
             </tr>
             <tr>
                 <td>
                     <asp:Label ID="lblInvoiceList" runat="server" Text="List of Invoices:" />
                 </td>
                 <td>
                     <asp:Label ID="lblStatementList" runat="server" Text="List of Statement:" />
                 </td>
             </tr>
             
             <tr>
                 <td>
                      <div style="height: 380px; width: 600px;overflow:auto;">
                            <asp:GridView ID="grdInvoice" runat="server" AutoGenerateColumns="false"
                                Width="750" HeaderStyle-BackColor="silver" HeaderStyle-ForeColor="#6f788f" 
                                                HeaderStyle-Font-Bold="false"  
                                    OnPageIndexChanging="grdInvoice_PageIndexChanging" 
                                    onrowdatabound="grdInvoice_RowDataBound">
                                <EmptyDataTemplate>
                                    <asp:Label ID="lblNoRows" runat="server" Text="There are no Invoices." />
                                </EmptyDataTemplate>
                                <Columns>
                                    <asp:TemplateField>
                                    <HeaderTemplate>
                                         <input id ="SelectAllCheckBox" type="checkbox" name="SelectAllCheckBox" onclick="javascript: SelectAllStatement(this)">
                                    </HeaderTemplate>
                                        <ItemTemplate>
                    
                                            <asp:Literal ID="ltlInvoiceUniqueID" runat="server" Text='<%# Eval("InvoiceID") %>'
                                                Visible="false" />
                                           <%-- <asp:Literal ID="ltlStatementUniqueID" runat="server" Text='<%# Eval("StatementUniqueID") %>'
                                                Visible="false" />
                                            <asp:Literal ID="ltlStatementAmount" runat="server" Text='<%# Eval("StatementAmount") %>'
                                                Visible="false" />--%>
                                            <asp:CheckBox ID="chkSelect" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="Invoice No" DataField="InvoiceNumber" HeaderStyle-Font-Bold = "false"/>
                                    <asp:BoundField HeaderText="Date" DataField="InvoiceDate" HeaderStyle-Font-Bold = "false" />
                                    <asp:BoundField HeaderText="Amount" DataField="Amount" HeaderStyle-Font-Bold = "false" DataFormatString="{0:N}"/>
                                    <asp:BoundField HeaderText="Payment Ref No/Cheque No" DataField="PORef" HeaderStyle-Font-Bold = "false"/>
                                   <%-- <asp:BoundField HeaderText="Reconciled Amount" DataField="ReconciledAmount" HeaderStyle-Font-Bold="false" />--%>
                                    <%--<asp:BoundField HeaderText="Remaining Amount" DataField="AmountToReconcile" HeaderStyle-Font-Bold="false" />--%>
                                </Columns>
                                <HeaderStyle BackColor="#284E98" BorderColor="#EFF3FB" BorderStyle="Solid" BorderWidth="2px" Font-Bold="True" Font-Size="0.9em" ForeColor="White" HorizontalAlign="Center" />
                            </asp:GridView>
                    </div>
                 </td>
                 <td>
                      <%--      Statement disply --%>

                        <div style="height: 380px; width: 600px;overflow:auto;">
       
                                 <asp:GridView ID="grdStatement" runat="server" AutoGenerateColumns="false" Width="600"
                                    HeaderStyle-BackColor="silver" HeaderStyle-ForeColor="#6f788f" ForeColor="#333333"
                                    HeaderStyle-Font-Bold="false">
                                    <EmptyDataTemplate>
                                        <asp:Label ID="lblNoRows" runat="server" Text="There are no Statements to be matched." />
                                    </EmptyDataTemplate>
                                    <Columns>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                                <input id="SelectAllCheckBox" type="checkbox" name="SelectAllCheckBox" onclick="javascript: SelectAllStatement(this)">
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Literal ID="ltlStatementUniqueID" runat="server" Text='<%# Eval("StatementID") %>' Visible="false" />
                                                <input id="chkSelect" type="checkbox" name="chk" runat="server" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField HeaderText="PaymentRef#/Cheque#" DataField="referenceNumber" HeaderStyle-Font-Bold="false" />
                                        <asp:BoundField HeaderText="Date" DataField="valueDate" HeaderStyle-Font-Bold="false" />
                                        <asp:BoundField HeaderText="Narration1" DataField="narration1" HeaderStyle-Font-Bold="false" />
                                        <asp:BoundField HeaderText="Amount" DataField="amount" HeaderStyle-Font-Bold="false" DataFormatString="{0:N}"/>
                                        <asp:BoundField HeaderText="Reconciled Amount" DataField="ReconciledAmount" HeaderStyle-Font-Bold="false" DataFormatString="{0:N}" />
                                        <asp:BoundField HeaderText="Remaining Amount" DataField="AmountToReconcile" HeaderStyle-Font-Bold="false" DataFormatString="{0:N}"/>
                                    </Columns>
                                    <HeaderStyle BackColor="#284E98" BorderColor="#EFF3FB" BorderStyle="Solid" BorderWidth="2px" Font-Bold="True" Font-Size="0.9em" ForeColor="White" HorizontalAlign="Center" />
                                </asp:GridView>
                        </div>

                 </td>
             </tr>
             <%--<tr>
                 <td class="auto-style4">
                     <span>
                        <asp:Label ID="lblPaymentReferenceNumber" runat="server" Text="Payment Reference No: "
                            AssociatedControlID="txtPaymentReferenceNumber" />
                        <br />
                        <asp:TextBox ID="txtPaymentReferenceNumber" runat="server" MaxLength="20" />
                        <asp:Button ID="btnMarkPayment" runat="server" Text="Mark Payment" OnClick="btnMarkPayment_Click" />
                    </span>
                 </td>
                 <%--<td class="auto-style4">
                        <div style="azimuth: center;">
                            <asp:Button ID="btnConfirmMatches" runat="server" Text="Confirm Matches" OnClick="btnConfirmMatches_Click" Visible="false" />
                        </div>
                 </td>
             </tr>--%>
         </table>
        
       



     <div id="pnlRemitterList" runat="server" class="pnlMatchList" style="height: 550px; width: 850px; overflow: auto; azimuth: center;border-width: 4px; border-style: double; border-color: red;">
         <span style="float:right;flex-align:center">
             <asp:ImageButton ID="popupClose" runat="server" ImageUrl="../Images/close.jpg" OnClick="popupClose_Click"/>
         </span>
         
                   <table>
                       
                       <tr>
                           <td align="center" style="background:#284E98;">
                               <asp:Label ID="Label1" runat="server" Text="Please select statements needs to match." ForeColor="White"/>
                           </td>
                       </tr>
                       <tr>
                           <td>
                               <div style="height: 500px; width: 850px; overflow: auto; azimuth: center; padding: 5px;">
                                    <asp:GridView ID="gridStmtSearchResult" runat="server" AutoGenerateColumns="false" CssClass="formDiv"
                                       
                                        HeaderStyle-Font-Bold="false" >
                                        <EmptyDataTemplate>
                                            <asp:Label ID="lblNoRows" runat="server" Text="There are no Invoice selections to be sent to Remitter." />
                                        </EmptyDataTemplate>
                                        <Columns>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                                <input id="SelectAllCheckBox" type="checkbox" name="SelectAllCheckBox" onclick="javascript: SelectAllStatement(this)">
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Literal ID="ltlStatementUniqueID" runat="server" Text='<%# Eval("StatementID") %>' Visible="false" />
                                                <input id="chkSelect" type="checkbox" name="chk" runat="server" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField HeaderText="PaymentRef#/Cheque#" DataField="referenceNumber" HeaderStyle-Font-Bold="false" />
                                        <asp:BoundField HeaderText="Date" DataField="valueDate" HeaderStyle-Font-Bold="false" />
                                        <asp:BoundField HeaderText="Narration1" DataField="narration1" HeaderStyle-Font-Bold="false" />
                                        <asp:BoundField HeaderText="Amount" DataField="amount" HeaderStyle-Font-Bold="false" DataFormatString="{0:N}" />
                                        <asp:BoundField HeaderText="Reconciled Amount" DataField="ReconciledAmount" HeaderStyle-Font-Bold="false" />
                                        <asp:BoundField HeaderText="Remaining Amount" DataField="AmountToReconcile" HeaderStyle-Font-Bold="false" />
                                    </Columns>
                                         <HeaderStyle BackColor="#284E98" BorderColor="#EFF3FB" BorderStyle="Solid" BorderWidth="2px" Font-Bold="True" Font-Size="0.9em" ForeColor="White" HorizontalAlign="Center" />
                                    </asp:GridView>
                             </div>
                           </td>
                       </tr>
                       <tr>
                           <td>
                                <div class="formDiv" style="width: 22%; border: 0.1em solid #FFFFFF; background: #FFFFFF;">
                                    <asp:Button ID="btnConfirmRemitter" runat="server" Text="Confirm" OnClick="btnConfirmRemitter_Click"
                                        />
                                    <asp:Button ID="btnCancelRemitter" runat="server" Text="Cancel"
                                         />
                                </div>
                           </td>
                       </tr>
                   </table>
                        
                  <div style="display: none">
                    <asp:Button ID="btnRemitterPopup" runat="server" />
                  </div>

                    <ajax:ModalPopupExtender ID="StatementSearchResultPopup" runat="server" PopupControlID="pnlRemitterList"
                        TargetControlID="btnRemitterPopup" BackgroundCssClass="modalBackground" RepositionMode="RepositionOnWindowScroll">
                    </ajax:ModalPopupExtender>
                    
                   
             </div>
   
       


        


   <%-- <span title="Statement List" style="azimuth: right; position: absolute; top: 200px;
        right: 100px; width: 400px;">
        <asp:Label ID="lblPaymentReferenceNumber" runat="server" Text="Payment Reference No: "
            AssociatedControlID="txtPaymentReferenceNumber" />
        <br />
        <asp:TextBox ID="txtPaymentReferenceNumber" runat="server" MaxLength="20" />
        <asp:Button ID="btnMarkPayment" runat="server" Text="Mark Payment" OnClick="btnMarkPayment_Click" />
    </span>
    <div style="azimuth: center;">
        <asp:Button ID="btnConfirmMatches" runat="server" Text="Confirm Matches" OnClick="btnConfirmMatches_Click" Visible="false" />
    </div>--%>
     <script type="text/javascript">
         function SelectAllStatement(CheckBoxControl) {
             if (CheckBoxControl.checked == true) {
                 var i;
                 for (i = 0; i < document.forms[0].elements.length; i++) {
                     if ((document.forms[0].elements[i].type == 'checkbox') && (document.forms[0].elements[i].name.indexOf('grdInvoice') > -1)) {
                         document.forms[0].elements[i].checked = true;
                     }
                 }
             }
             else {
                 var i;
                 for (i = 0; i < document.forms[0].elements.length; i++) {
                     if ((document.forms[0].elements[i].type == 'checkbox') &&
                    (document.forms[0].elements[i].name.indexOf('grdInvoice') > -1)) {
                         document.forms[0].elements[i].checked = false;
                     }
                 }
             }
         }


         function ShowPopup(msg) {
             $(function () {

                 $("#dialog-modal").dialog({
                     title: msg,
                     height: 400,
                     width: 600,
                     buttons:
                         {
                             Close: function () {
                                 $(this).dialog('close');
                             },
                             Ok: function () {
                                 $(this).dialog('close');
                             }
                         },
                     modal: true
                 });


             });
         };

        </script>
     </div>
</asp:Content>
